/*
 * Copyright (C) 2018 guomw.Inc. All rights reserved.
 * 项目名称： report-manage
 * 文件名称： RandomUtils.java
 * Date：18-11-5 上午10:54
 * Author: guomw
 */

package com.guomw.report.common.utils;

import java.util.Random;
import java.util.UUID;

/**
 * @author guomw
 * @date 2018/9/21
 */
public class RandomUtils {
    private static Random random = new Random();
    private static final String codeStr = "ABCDEFGHIJKLMNPQRSTUVWXYZ123456789abcdefghijklmnpqrstuvwxyz";

    /**
     * 根据位数生成验证码
     *
     * @param size 位数
     * @return
     */
    public static String randomNumber(int size) {
        StringBuilder retNum = new StringBuilder();
        for (int i = 0; i < size; i++) {
            retNum.append(codeStr.charAt(random.nextInt(codeStr.length())));
        }
        return retNum.toString();
    }

    public static String getUUID(){
        return UUID.randomUUID().toString().replace("-", "");
    }

}
